#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
	int i = 0, j = 0;
	char ch = 0;
	while ((ch = getchar()) != '#')
	{
		if (ch == 'e')
			i = 1;
		if (ch == 'i' && i == 1)
		{
			j++;
			i = 0;
		}
		putchar(ch);
	}
	printf("%d", j);

	return 0;
}